﻿using Newtonsoft.Json;
using shuatibao.Question;
using shuatibao.Tool;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

namespace shuatibao.Web.Question
{
    /// <summary>
    /// Question_Add 的摘要说明
    /// </summary>
    public class Question_Add : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            // 获取POST请求的JSON数据
            string requestJson = new StreamReader(context.Request.InputStream).ReadToEnd();
     
            QuestionModel questionModel = JsonConvert.DeserializeObject<QuestionModel>(requestJson);
            QuestionAction.insertQuestionManager(questionModel);
            Utils.jsonBackManager(context, "success");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}